﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;

using Microsoft.Samples.Office.UnifiedCommunications.Gadget.Config;
using Microsoft.Samples.Office.UnifiedCommunications.Gadget.DTO;

namespace Microsoft.Samples.Office.UnifiedCommunications.Gadget
{
    public class PresenceEventCollection : ObservableCollection<PresenceEvent>
    {
        public PresenceEventCollection(string sipUri)
        {
            PresenceEventElementCollection presenceEventElements = GadgetConfigurationManager.GetPresenceEvents(sipUri);

            foreach (PresenceEventElement item in presenceEventElements)
            {
                this.Add(
                    new PresenceEvent() 
                        {
                            PresenceEventId = item.PresenceEventId,
                            SipUri = item.SipUri,
                            PresenceEventDateTime = item.PresenceEventDateTime,
                            StatusText = item.StatusText
                        });
            }
        }
    }
}
